const http = require('http')

/**
 * 构造http1.0
 * @type {http.ServerResponse._storeHeader}
 */
const serverResponseStoreHeader = http.ServerResponse.prototype._storeHeader;
http.ServerResponse.prototype._storeHeader = function () {
    this.httpVersion = '1.0';
    arguments[0] = 'HTTP/1.0' + arguments[0].slice(8);
    serverResponseStoreHeader.apply(this, arguments);
};

http.createServer(((req, res) => {
    console.log(req.url)
    res.end('Hello , this is http 1.0 version')
})).listen( 3000, err => {
    if (err) {
        return console.log('something bad happened', err)
    }
    console.log('server is listening on 3000')
});
